package com.beordie.service.impl;

import com.beordie.dao.IStudentDao;
import com.beordie.dao.impl.StudentDaoImpl;
import com.beordie.model.Student;
import com.beordie.service.IStudentService;
import com.beordie.utils.DBUtils;
import com.beordie.utils.PageUtils;

import javax.enterprise.inject.New;
import java.util.List;

/**
 * @Classname StudentDaoImpl
 * @Description TODO
 * @Date 2021/6/8 12:44
 * @Created 30500
 */
public class StudentServiceImpl implements IStudentService {
    private IStudentDao dao = new StudentDaoImpl();

    @Override
    public List<Student> getAllStudents(String stuName, String stuNo, String stuSex, PageUtils pageUtils) {
        int sex = Integer.parseInt(stuSex);
        return dao.getAllStudents(stuName, stuNo, sex, pageUtils);
    }

    @Override
    public int getCOunt(String stuName, String stuNo, String stuSex) {
        int sex = Integer.parseInt(stuSex);
        return dao.getCount(stuName, stuNo, sex);
    }

    @Override
    public Student getByStuId(String stuId) {
        int id = Integer.parseInt(stuId);
        return dao.getByStuId(id);
    }

    @Override
    public int delByStuId(String stuId) {
        int id = Integer.parseInt(stuId);
        return dao.delByStuId(id);
    }

    @Override
    public int updateInfo(Student student) {
        return dao.updateInfo(student);
    }

    @Override
    public int addAllInfo(Student student) {
        return dao.addAllInfo(student);
    }
}
